#ifndef BOARD_H_
#define BOARD_H_
/*******************************************************************************
 * File name: 		board.h
 * Description:		board specyfic functions
 * Project: 		_lpc1788
 * Target: 			LPC1788
 * Compiler: 		arm-none-eabi-gcc
 * Date: 			04-07-2012
 * Author: 			Kuba
 * Based on: 		---
 ******************************************************************************/

/*==============================================================================
 Includes
==============================================================================*/
# include "typedef.h"
# include "irq.h"
# include "gpio.h"
/*==============================================================================
 Defines
==============================================================================*/

/*==============================================================================
 Types
==============================================================================*/
struct io {
	enum gpioPort port;
	uint32 pin;
};

/*==============================================================================
 Globals
==============================================================================*/

/*==============================================================================
 Global function prototypes
==============================================================================*/
/*------------------------------------------------------------------------------
 function name:		boardLedInit
 description:		init led
 parameters:		port, led pin number. NOTE: pins start from 0.
 returned value:	led
------------------------------------------------------------------------------*/
struct io boardLedInit   (const enum gpioPort port, const uint32 pin);

/*------------------------------------------------------------------------------
 function name:		boardLedOn
 description:		turn on led
 parameters:		led
 returned value:	none
------------------------------------------------------------------------------*/
void boardLedOn     (const struct io led);

/*------------------------------------------------------------------------------
 function name:		boardLedOn
 description:		turn off led
 parameters:		led
 returned value:	none
------------------------------------------------------------------------------*/
void boardLedOff    (const struct io led);

/*------------------------------------------------------------------------------
 function name:		boardLedToggle
 description:		toggle led
 parameters:		led
 returned value:	none
------------------------------------------------------------------------------*/
void boardLedToggle (const struct io led);

/*------------------------------------------------------------------------------
 function name:		boardSwitchInit
 description:		init micro-switch
 parameters:		port, pin number
 returned value:	port and pin number
------------------------------------------------------------------------------*/
struct io boardSwitchInit (const enum gpioPort port, const uint32 pin);

/*------------------------------------------------------------------------------
 function name:		boardSwitchPressed
 description:		check if switch is pressed, if it calls user service
 parameters:		port and pin number of uswitch
 returned value:	true or false
------------------------------------------------------------------------------*/
bool boardSwitchPressed (const struct io uswitch);

/*------------------------------------------------------------------------------
 function name:		boardSwitchIrqInit
 description:		init switch interrupt
 parameters:		interrupt priority, user service- a function called when switch
 	 	 	 	 	 is pressed
 returned value:	none
------------------------------------------------------------------------------*/
bool boardSwitchIrqEnable (const struct io uswitch, const enum irqPriority priority, void (*const service)(void));

/******************************************************************************
* END OF FILE
******************************************************************************/
#endif /* BOARD_H_ */
